import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (job) => {
    const res = await request({
        url: "/a/content/job/list",
        method: "post",
        params: {
            jobTitle: job.jobTitle,
            pageNo: job.pageNo,
            pageSize: job.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveJob = async (job) => {
    const res = await request({
        url: "/a/content/job/save",
        method: "put",
        params: {
            jobBackground: job.jobBackground,
            jobTitle: job.jobTitle,
            jobExperience: job.jobExperience,
            jobDetail: job.jobDetail,
            sort:  job.sort,
            remarks: job.remarks,

        }
    })
    return res.data;
}



//更新数据
fun.updateJob = async (job) => {
    const res = await request({
        url: "/a/content/job/update",
        method: "post",
        params: {
            id: job.id,
            jobBackground: job.jobBackground,
            jobTitle: job.jobTitle,
            jobExperience: job.jobExperience,
            jobDetail: job.jobDetail,
            sort:  job.sort,
            remarks: job.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/job/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getJob = async (id) => {
    const res = await request({
        url: "/a/content/job/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;